package com.capgemini.remind.service;

import com.capgemini.commons.IdUtils;
import com.capgemini.core.PageList;
import com.capgemini.remind.mapper.CustomerPromotionMapper;
import com.capgemini.remind.pojo.CustomerPromotion;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.Date;
import java.util.List;

/**
 * 
 * @author
 * @date
 */
@Service
@Transactional
public class CustomerPromotionService {
	public final Logger log = LoggerFactory.getLogger(this.getClass());

	@Autowired
	private CustomerPromotionMapper customerPromotionMapper;


	public int insert(CustomerPromotion pojo){

//		pojo.buildCreateInfo();
		Date now = new Date();

		pojo.setCreateDate(now);
		pojo.setLastUpdateDate(now);


		return customerPromotionMapper.insert(pojo);
	}


	public int updateById(CustomerPromotion pojo){

		pojo.setLastUpdateDate(new Date());
		return customerPromotionMapper.updateById(pojo);
	}

	public void queryPage(final PageList<CustomerPromotion> pageList) {
		pageList.setItems(customerPromotionMapper.queryPage(pageList));
	}

	public List<CustomerPromotion> queryList(CustomerPromotion param) {
		return customerPromotionMapper.queryList(param);
	}

	public int deletePhysicalById(String id) {
		return customerPromotionMapper.deletePhysicalById(id);
	}

	public CustomerPromotion getById(String id) {
		return customerPromotionMapper.getById(id);
	}
}
